package com.ioftv.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * Web配置类
 * 配置Web相关的设置
 * 
 * @author 李孟鸠
 */
@Configuration
public class WebConfig implements WebMvcConfigurer {
    
    @Autowired
    private JwtAuthenticationFilter jwtAuthenticationFilter;
    
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        // 注册JWT认证过滤器
        registry.addInterceptor(jwtAuthenticationFilter)
                .addPathPatterns("/**")  // 拦截所有请求
                .excludePathPatterns("/admin/login", "/admin/logout");  // 排除登录和退出接口
    }
}